#include "PushWork.h"


int PushWork::Init(const Properties& properties)
{
    audio_test_ = properties.GetProperty("audio_test", 0);
    pcmInName_ = properties.GetProperty("input_pcm_name", "input_48k_2ch_s16.pcm");

    micSampleRate_ = properties.GetProperty("mic_sample_rate", 48000);
    micSampleFmt_ = properties.GetProperty("mic_sample_fmt", AV_SAMPLE_FMT_S16);
    micChannels_ = properties.GetProperty("mic_channels", 2);

    audio_sampleRate_ = properties.GetProperty("audio_sample_rate", 48000);
    audio_bitrate_ = properties.GetProperty("audio_bitrate", 128 * 1024);
    audio_channels_ = properties.GetProperty("audio_channels", micChannels_);
    audio_ch_layout_ = av_get_default_channel_layout(audio_channels_);

    video_test_ = properties.GetProperty("video_test", 0);
    yuvInName_ = properties.GetProperty("input_yuv_name", "input_1280_720_420p.yuv");

    desktop_x_ = properties.GetProperty("desktop_x", 0);
    desktop_y_ = properties.GetProperty("desktop_y", 0);
    desktop_width_ = properties.GetProperty("desktop_width", 2560);
    desktop_height_ = properties.GetProperty("desktop_height", 1440);
    desktop_fmt_ = properties.GetProperty("desktop_pixel_format", AV_PIX_FMT_YUV420P);
    desktop_fps_ = properties.GetProperty("desktop_fps", 25);

    video_width_ = properties.GetProperty("video_width", desktop_width_);
    video_height_ = properties.GetProperty("video_height", desktop_height_);
    video_fps_ = properties.GetProperty("video_fps", desktop_fps_);
    video_gop_ = properties.GetProperty("video_gop", video_fps_);
    video_bitrate_ = properties.GetProperty("video_bitrate", 1024 * 1024);
    video_b_frames_ = properties.GetProperty("video_b_frames", 0);

    rtmp_url_ = properties.GetProperty("rtmp_url", "");
    if(rtmp_url_ == "")
    {
        return -1;
    }
    rtmp_debug_ = properties.GetProperty("rtmp_debug", 0);

    // SDL



}
